

# # 字符串
# # 1.字符串编码转换
# a = "你好"
# print(a,type(a))     # str,字符串是以字符为单位进行处理的
# a1 = a.encode()      # 编码
# print("编码后",a1)
# print(type(a1))      # bytes,字节流
# a2 = a1.decode()     # 解码
# print("解码后",a2)
# print(type(a2))      # str,字符串
# # 注意：对于bytes，只需要直到它跟字符串类型之间的互相转换
#
#
# # 2.字符串常见操作
# # 2.1 字符串拼接
# a = "hello"
# b = "world"
# c = a+b
# print(c)
# # 2.2 字符串重复
# a = "hello"
# b = a*3
# print(b)
# # 2.3 字符串切片
# a = "hello world"
# b = a[0:5]
# print(b)
# # 2.4 字符串查找
# a = "hello world"
# b = a.find("l")
# print(b)
# # 2.5 字符串替换
# a = "hello world"
# b = a.replace("l","L")
# print(b)
# # 2.6 字符串大小写转换
# a = "Hello World"
# b = a.lower()
# print(b)
# c = a.upper()
# print(c)
# # 2.7 字符串格式化
# a = "hello {}"
# b = a.format("world")
# print(b)

# # index()方法
# name = "你是龙还是虾，我是龙虾"
# print(name.index("龙"))
# print(name.index("龙",1))  # 从1开始查找
# print(name.index("龙",1,5))  # 从1开始查找，直到5结束

# # count()方法
# name = "你是龙还是虾，我是龙虾"
# print(name.count("龙"))
# print(name.count("虾",1))  # 从1开始查找
# print(name.count("龙",1,5))  # 从1开始查找，直到5结束


str1 = "hello,world"
print(str1.split(","))  # 按逗号分割字符串，返回列表











